const Router = require('@koa/router');
// Koa 的路由在被 use 时是无法指定前缀的, 需要在定义时就指定前缀
const router = Router({
    prefix: '/api/mgRecord'
});

const mgRecordController = require('../controllers/mgRecordController');

// 组装路由
router.get('/', mgRecordController.listAll);
router.get('/:id', mgRecordController.getOneById);
router.get('/getGroupDescPrice/:mg_id', mgRecordController.getGroupDescPrice);
router.get('/getGroupDescDay/:mg_id', mgRecordController.getGroupDescDay);
router.post('/', mgRecordController.add);
router.post('/deleteBatchByIds', mgRecordController.deleteBatchByIds);
router.put('/', mgRecordController.updateOneById);
router.delete('/:id', mgRecordController.deleteById);
router.post('/queryPage', mgRecordController.queryPage);

// Koa 的路由需要调用 routes 函数获取实际用于 use 的函数
module.exports = router.routes();
